define(['jq'], () => {
    class List {
        constructor() {
            this.ul = document.querySelector('.list8>ul')
            console.log(this.ul)
            this.listbox = document.querySelector('.list8')

            this.request()


        }

        request() {
            $.ajax({
                url: './data/indexlast.json',   // 必填，请求的地址 （获取这里填获取数据的地址）
                type: 'GET',   // 选填，请求方式，默认是 GET（忽略大小写）



            }).then(res => {

                // console.log(res)
                var data = res.result
                // console.log(data)
                this.render(data)
            })

        }
        render(data) {
            data.forEach((item) => {
                this.ul.innerHTML += `
                <li>
            
                <div class="cover">
                    <img src="${item.cover}">
                </div>
                <div class="inbigbox">
                <div class="inbox">
                <p class="title hide">${item.title}</p>
                <p class="summary hide">${item.summary}</p>
                </div>
                <p class="lowestPrice">￥${item.lowestPrice}起</p>
                </div>
  
                <div class="downbox">
                <span>${item.collectNum}</span>
                <span>${item.viewNum}</span>
                <span class="last">${item.replyNum}</span>
                </div>
                
               
            </li> 
                `
            })
            this.listbox.onmouseover = (e) => {

                let target = e.target || e.scrElement
                if (target.nodeName == 'IMG') {
                    target.className = 'animate__animated animate__pulse'

                }
            }
            this.listbox.onmouseout = function (e) {
                let target = e.target || e.scrElement
                if (target.nodeName == 'IMG') {
                    target.className = ''

                }
            }
        }
    }
    new List()

});